import QtQuick 1.1
import com.nokia.meego 1.0

Page {
  id: splashMain
  property int timeout: 2000
  property bool show: true
  signal splashTimeout()
  state: show ? "showingSplashScreen" : ""
  opacity: 0.0
  onStateChanged: {
    if (state == "showingSplashScreen" ){
      splashTimer.start();
    }
  }
  onSplashTimeout: {
    appState.currentViewName = "feedView";
    pageStack.push(feedView)
  }

  Rectangle {
    id: splash
    color: "#4d1f41"
    anchors.fill: parent

    Image {
      id: osho
      x: 239
      y: 582
      anchors.right: parent.right
      anchors.rightMargin: 10
      anchors.bottom: parent.bottom
      anchors.bottomMargin: 10
      source: "resources/ohso.png"
    }

    Image {
      id: logo
      x: 23
      y: 169
      anchors.horizontalCenter: parent.horizontalCenter
      anchors.verticalCenter: parent.verticalCenter
      source: "resources/logo.png"
    }
  }

  Timer {
    id: splashTimer
    interval: timeout
    running: false
    repeat: false;
    onTriggered: { splashMain.splashTimeout(); splashMain.show = false;  }
  }

  states: [
    State {
      name: "showingSplashScreen"
      PropertyChanges {
        target: splashMain
        opacity: 1.0
      }
    }
  ]

  transitions: [
    Transition {
      from: "showingSplashScreen"
      to: "feedView"
      PropertyAnimation {
        property: "opacity"
        duration: 500
      }
    }
  ]
}
